package com.slkj.shilixiaoyuanapp.view;

import android.content.Context;

import com.yanyusong.y_divideritemdecoration.Y_Divider;
import com.yanyusong.y_divideritemdecoration.Y_DividerBuilder;
import com.yanyusong.y_divideritemdecoration.Y_DividerItemDecoration;

public class GridItemDecoration extends Y_DividerItemDecoration {

    public GridItemDecoration(Context context) {
        super(context);
    }

    @Override
    public Y_Divider getDivider(int itemPosition) {
        Y_Divider divider = null;
            switch (itemPosition % 2) {
                case 0:
                    //每一行第一个显示 rignt 和 bottom
                    divider = new Y_DividerBuilder()
                            .setRightSideLine(true, 0xffffffff, 7, 0, 0)
                            .setBottomSideLine(true, 0xffffffff, 7, 0, 0)
                            .setTopSideLine(true, 0xffffffff, 7, 0, 0)
                            .setLeftSideLine(true, 0xffffffff, 15, 0, 0)
                            .create();
                    break;
                case 1:
                    //第二个显示 Left 和 bottom
                    divider = new Y_DividerBuilder()
                            .setLeftSideLine(true, 0xffffffff, 7, 0, 0)
                            .setBottomSideLine(true, 0xffffffff, 7, 0, 0)
                            .setTopSideLine(true, 0xffffffff, 7, 0, 0)
                            .setRightSideLine(true,0xffffffff,15,0,0)
                            .create();
                    break;
                default:
                    break;
            }
        return divider;
    }
}
